package com.sky.mapper;

import com.github.pagehelper.Page;
import com.sky.dto.OrdersPageQueryDTO;
import com.sky.entity.OrderDetail;
import com.sky.entity.Orders;
import com.sky.entity.User;
import com.sky.vo.OrderVO;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface OrderMapper {

    void save(Orders orders);

    void saveDetail(List<OrderDetail> orderDetail);
    @Select("select * from orders where number=#{orderNumber}")
    Orders queryByNumber(String orderNumber);

    void update(Orders orders);

    @Select("select * from orders where id=#{id}")
    OrderVO queryById(Long id);

    @Select("select * from order_detail where order_id=#{id}")
    List<OrderDetail> queryDetailByOrderId(Long id);

    Page<OrderVO> pageQuery(OrdersPageQueryDTO ordersPageQueryDTO);
    @Select("select count(*) from orders where status=#{status} ")
    Integer queryByStatus(int status);
}
